Define Formula Expressions

This is where a user will be able to build the formula for his business needs. Using certain pre-defined arguments, the user will structure the formula into steps and will be able to test it. The expression is made of different types of results which could be simple type or collection.

To define a formula expression:

  1. Open the Main Menu () in FintechOS Studio.
  2. Select Business Formulas.
  3. Select Formula.
  4. Click the Insert button () at the top right corner of the page.
  5. Enter a Name for the formula.
  6. Select the Start Date at which the formula becomes active. Automatically, it sets the current date, but it is possible to change it. It selects the time as well.
  7. In the Formula Input field, select the set of arguments that will be processed by the formula (see Define Formula Inputs for details).
  8. The End Date and Version fields are populated automatically based on the formula's versioning. For details, see Formula Versioning.
  9. Click the Save and Reload () button at the top right corner of the page.

  10. After activating the formula which must have at least one step to be activated, it is possible to clone a formula by clicking on the button on the right -side of the corner.

Add steps to a formula

Steps allow you to process a formula in successive stages. The output from a step can be used as an input argument in subsequent steps that is why the order of the steps is very important. The steps decide which part of the calculation is done first, second, third etc.

For example, it is possible to create a formula to calculate the premium amount in the first step and use the result as an input step in the second to calculate the monthly payment installments by dividing the premium amount resulted first to the months selected by the client.

It has two main steps: the selection for the type of result and the Formula Editor where the formula is written.

  1. In the formula screen, in the Formula Steps section, click the Insert button to add a step.
  2. Enter a Name for the step. The name must be unique in the formula (Two steps can be named the same, but must be in different formulae.) This name can be used in subsequent steps as an input argument.
  3. The Formula Id field is automatically populated with your formula name.
  4. In the Master Type field select the data type for the step's result. This can be either Simple Type (a single value) or Collection (a set of multiple values).
    If the master type is a Collection, you will have to specify in the Number of Iterations field the formula argument that will be iterated to generate the collection.

    For example, to generate a collection with the first x numbers in Fibonacci sequence, use a whole number input argument called x for the number of iterations (make sure x is greater than or equal to 2) and use the following formula expression:

    “result[0] = 1;

    result[1] =1;

    result[i] = result[i-1] + result[i-2];”

    HINT  
    Where the formula body is complex, needs periodic update or must be simplified for transparency and traceability, we suggest you split it in separate steps, each with its own expression. This architecture allows calling the result of step N-1 in step N (“result = step 1 + a;”).
  5. In the Sub-Type field, enter the data type for the step's result:

    • Whole Number
    • Decimal
    • Boolean - only for Simple Type master types
    • Text - only for Simple Type master types
    • Object - only for Simple Type master types
  6. Calculation Type can be set as either Normal or as an Iteration, in which case you will have to specify the formula argument that will be iterated in your formula. Current Formula Step cannot be set as iteration argument.
  7. Enter the expression for the formula step in the Formula field. For details, see Formula Editor.
  8. Click the Save and Close button () at the top right corner of the page.
  9. Repeat for any additional steps you wish to include in your formula. The output from a step can be used as an input argument in subsequent steps.
    NOTE  
    New formula steps cannot be added on an active formula. To add steps to a formula create a new versioning (see Formula Versioning).

After you've added all the steps, click the Save and Close button () at the top right corner of the page.

HINT  
The order used for each step is indicated in the Oder Index column on the right in the grid.

Test Your Formula

You can create various tests for a formula to see how it performs.

To create a formula test:

  1. In the formula screen, in the Formula Tests section, click the Insert button to add a test.
  2. Enter a Name for your test.
  3. Enter a Reference Date for the test. By default this will be the current date and time. Depending on the Reference Date that the user chooses, the engine will use the version of the formula that is active at the reference date.
  4. The Formula field will be automatically populated with the formula name.
  5. Click the Save and Reload button () in the top right corner of the screen. A new button will appear called ''Test Formula''.
  6. Edit the Input field with the desired input parameters. This field is filled in automatically with the input form the formula and with default values for each argument from this input. The user can just insert some values, not necessarily arguments.
  7. Click the Test Formula button at the top right corner of the page.
  8. Check the Execution Successful checkbox and the Output field to investigate the formula execution.

If the result is an error a new text box will appear. In the text box, the system will retrieve the reason for the error.

Activate a Formula

To activate a formula draft, in the formula page, click the Next Status: Active field in the top left corner of the screen.

The activation stage implies new conditions for the formula:

  • it is possible to create a new version of the formula

  • to activate a formula, it is necessary to have at least one step
  • the form is readonly
  • it can only go into the Closed state. For any other changes to this formula, a new version needs to be created.

  • when a versioned formula goes into Active status, the parent formula end date will be updated with the versioned formula start date and its status will be updated to Closed.

Formula Versioning

When you first create a formula, it will be in a Draft state, meaning that it can be edited and tested, but not used by the system. User cannot create a new version from this state by clicking the button ''Create new version'' on the right-side of the screen.

Create a New Formula Version Draft

Once a formula has been activated, it cannot be modified. Instead, a ''Create New Version'' button will appear in the top right corner of your formula page. This button will allow anyone to create a new version of the same formula and a user will be able to make modifications for the new version. It will create a new version with start date today or the start date of the formula if it is in the future.

Click the Create New Version button to create a new Draft version based on the active formula. You can edit the draft version while the active formula is still enabled. It will have the same name as the original one, but the version number will be increased by one, and the start date will be current date, or start date of the previous version plus day. To find the New Formula Version Draft, open the formula you wish to change and click on the ''History'' tab where all modifications are shown.

Activate a Formula Version Draft

Once you finish updating the draft version, change its status from Draft to Active as shown in the Activate a Formula section. The previously active version will be set to a Closed state, and the draft version will become the currently active version.

You can track the formula versions in the History tab of the formula page.